<%-- 
    Document   : xsd_browse
    Created on : 8.5.2014, 15:46:35
    Author     : Fufi
--%>

<%@page import="java.util.Date"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<h1>Search for XSD schemas</h1> 

<form method="post" action="${pageContext.request.contextPath}/xsd/browse/">
    <table>
        <tr>
            <td>
                <select name="searchType">
                    <option value="simple">Simple types</option>
                    <c:choose>
                        <c:when test="${searchTypeSelect eq 'complex'}">                            
                            <option value="complex" selected>Complex types</option>
                        </c:when>
                        <c:otherwise>
                            <option value="complex">Complex types</option>
                        </c:otherwise>
                    </c:choose>
                </select>
            </td>
            <td><input type="text" value="${typeNameInput}" name="typeName" /></td>
        </tr>
        <tr>
            <td>Name : </td>
            <td><input type="text" value="${fileNameInput}" name="fileName"/></td>
        </tr>
    </table>


    <input type="submit" class="btn" />
</form>
<center>
    <h1>List of XSD schemas</h1>   
</center>
<ul class="no-padding-margin">
    <c:choose>
        <c:when test="${f:length(artifacts) gt 0}">
            <c:forEach var="item" items="${artifacts}">
                <jsp:useBean id="itemDate" class="java.util.Date" />
                <jsp:setProperty name="itemDate" property="time" value="${item.timeStamp}" />
                <li>
                    <div>
                        <a class="list-group-item width-80 flow-left" href="${pageContext.request.contextPath}/xsd/browse/${item.fileName}">${item.fileName} (<fmt:formatDate pattern="dd. MM. yyyy hh:mm:ss" value="${itemDate}" dateStyle="long" timeZone="GMT+2"/>)</a>
                        <a class="flow-right" href="${pageContext.request.contextPath}/xsd/delete/${item.fileName}" onclick="return confirm('Do you really want to delete all versions of this document?')">DELETE ALL VERSIONS</a>
                    </div>
                </li>
            </c:forEach>
        </c:when>
        <c:otherwise>
            No xsd atrifacts.
        </c:otherwise>
    </c:choose>
</ul>

